import {defineStore} from "pinia";
import {MenuOption}  from "naive-ui";

export type MenuStoreState = {
    active: string,
    options: MenuOption[]
    collapsed: boolean,
}

const useMenuStore = defineStore({
    id: 'menu-store',
    state():MenuStoreState{
        return {
            active: "",
            options: [],
            collapsed: true
        }
    },
    actions:{
        setActive(key:string){
            this.active = key
        },
        setCollapsed(collapsed:boolean){
            this.collapsed = collapsed
        },
        setOptions(options:MenuOption[]){
            // @ts-ignore
            this.options = options
        },

    }
})

export default useMenuStore